<template>
	<view class="page-fade-in" :style="{opacity: pageOpc}">
		<template v-if="pageOpc">
			<view class="content">
				<view class="shop-info-box">
					<view class="info-item flexWrapNo">
						<view class="item-title">wifi名称:</view>
						<input placeholder="请输入wifi名称" placeholder-class="placeholderclass" class="input-box" v-model="wifi_title"/>
					</view>
					<view class="info-item flexWrapNo">
						<view class="item-title">wifi密码:</view>
						<input placeholder="请输入wifi密码" placeholder-class="placeholderclass" class="input-box" v-model="wifi_pas"/>
					</view>
				</view>
				<view class="bottom-box flexWrapNo">
					<view class="define-btn" @tap="setWifiPro()">确定</view>
				</view>
			</view>
		</template>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageOpc:0,
				wifi_title:"",
				wifi_pas:""
			}
		},
		onLoad() {
			this.getWifi();
		},
		onReady(){
			setTimeout(() => {
				this.pageOpc=1
			}, 100)
		},
		methods: {
			getWifi(){
				this.$request.post(this.$api.getWifi,{
					store_id: uni.getStorageSync('store_id')
				}, {
					token:true
				}).then(res => {
					let {
						data = {}
					} = res;
					if (res.code==1) {
						this.wifi_title=data.wifi_title
						this.wifi_pas=data.wifi_pas
					}
				})
			},
			setWifiPro(){
				this.$request.post(this.$api.setWifiPro,{
					store_id: uni.getStorageSync('store_id'),
					wifi_title:this.wifi_title,
					wifi_pas:this.wifi_pas
				}, {
					token:true
				}).then(res => {
					let {
						data = {}
					} = res;
					if (res.code==1) {
						this.$tools.showToast('修改成功')
						setTimeout(()=>{
							uni.navigateBack({
								delta:1
							})
						},2000)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.content {
		padding: 0 36upx;
	
		.shop-info-box {
			.info-item {
				font-size: 28upx;
				font-family: PingFang SC;
				font-weight: 400;
				line-height: 40upx;
				color: #FFFFFF;
				padding: 20upx 0;
	
				.item-title {
					margin-right: 12upx;
					flex: none;
					font-size: 28rpx;
					width: 180upx;
				}
	
				.input-box {
					height: 100upx;
					width: 500upx;
					background:#1D1C5C;
					border-radius: 16upx;
					padding: 0 32upx;
					margin-top: 14upx;
					color: #fff;
					.placeholderClass {
						font-size: 32upx;
						font-family: PingFang SC;
						font-weight: 400;
						color: rgba(255, 255, 255, .5);
					}
				}
	
				input {
					height: 100upx;
					font-size: 28upx;
					font-family: PingFang SC;
					font-weight: 400;
					color: #fff;
				}
	
				.placeholderclass {
					font-size: 28rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #FFFFFF;
				}
			}
		}
	
		.map-box {
			height: 600upx;
			margin: 20upx 0;
	
			map {
				width: 100%;
				height: 100%;
			}
		}
	
		.exeplan-box {
			font-size: 28upx;
			color: #FFFFFF;
			line-height: 46upx;
	
			.exeplan-title {
				font-size: 32upx;
				margin-bottom: 20upx;
			}
		}
	
		.bottom-box {
			height: 120rpx;
			background: #1D1C5C;
			position: fixed;
			left: 0;
			right: 0;
			bottom: 0;
			margin: auto;
			justify-content: center;
			font-size: 32rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			.define-btn {
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
				line-height: 80rpx;
				width: 322rpx;
				height: 80rpx;
				background: #26BCFD;
				border-radius: 16rpx 16rpx 16rpx 16rpx;
				text-align: center;
			}
		}
	}
</style>
